Using TF to create escalation policy

Hello, I’m using the free version of PagerDuty and I’d like to Terraform the configuration.
I create a token with full access, I’m able to create users, notifications_rules, service, but when I want to create an escalation_policy, I get a 403 error without more information (even in DEBUG mode of TF).

response I have :
pagerduty_escalation_policy.escalation_policy: Creating…
â•·
│ Error: POST API call to https://api.pagerduty.com/escalation_policies failed: 403 Forbidden
│
│ with pagerduty_escalation_policy.escalation_policy,
│ on r-escalation_policy.tf line 1, in resource “pagerduty_escalation_policy” “escalation_policy”:
│ 1: resource “pagerduty_escalation_policy” “escalation_policy” {
│
╵
No more logs.

I delete the only on policy I had because with the free account I can have only one escalation policy, but the error is still there.

Any idea ?

Hello @frederic.pellin!

Thanks for reaching out. This HTTP error code typically indicates that the token you are using does not have the necessary permissions so I would start there.

Still, I’m tagging @josé.antonio.reyes who is the maintainer of the Terraform provider for awareness.

Hi @frederic.pellin! It looks like you are using a User token which already has a Team Role stopping you for creating that EP, so, in order to solve this, You have following alternatives:

  • Associate your Team to the Escalation Policy. (If possible)
  • Create an Account API Key with Admin level.
  • Use an App Scoped OAuth token with all read scopes and escalation_policies.write scope.

I hope this works for you.

btw @tiago.barbosa thanks for tagging me here :v:

1 Like

I’m in contact with the support, and there is a bug when using “escalation_rule_assignment_strategy” parameter.

If I remove it, TF and API call are OK.

No more information about the fix of the bug !

Hmmm… Ok, I get it now. What your experiencing is a feature gating issue, because as You mentioned at the very beginning, You currently using free version (Sorry, I overlooked that detail). Read more about this here. In same way, I’m attaching a capture of the heads-up at Round Robin Scheduling product page.